import Vue from 'vue'
import Vuex from 'vuex'
import '../lib/sockjs'
import '../lib/stomp'
import userIcon from '@imgs/chat/user.png'
Vue.use(Vuex)

export default new Vuex.Store({
	state: {
		wtitle: '', //标题内容
		tabSelectID: 1, //底部栏选择ID
		rback: false, //返回图标
		signed: window.localStorage.signed === undefined ? false : true, //用户登录状态
		share: false,
		revise: '', //修改页传值
		auctionIndex: 1,
		gosearch: false, //打开搜索页
		loadding: false, //请求加载状态
		balance: 0, //余额
		integral: 0, //积分
		msgList: [], //消息列表
		balance: 0, //余额
		integral: 0, //积分
		selfIcon: userIcon, //个人头像
		friendIcon: userIcon, //好友头像
    orderId: '',//订单id
    IntegralId: '',//积分id
	},
	mutations: {
		WTITLE(state, string) {
			state.wtitle = string
		},
		TABSELECTID(state, number) {
			state.tabSelectID = number
		},
		RBACK(state, boolean) {
			state.rback = boolean
		},
		USERSINGED(state, boolean) {
			state.signed = boolean
		},
		SHARE(state, boolean) {
			state.share = boolean
		},
		REVISE(state, string) {
			state.revise = string
		},
		AUCTIONINDEX(state, number) {
			state.auctionIndex = number
		},
		GOSEARCH(state, boolean) {
			state.gosearch = boolean
		},
		LOADDING(state, boolean) {
			state.loadding = boolean
		},
		// 更新消息列表
		updateMsgList(state, newMsgList) {
			state.msgList = newMsgList
		},
		// 设置个人头像
		SELFICON(state, string) {
			state.selfIcon = string
		},
		// 设置好友头像
		FRIENDICON(state, string) {
			state.friendIcon = string
		},
	},
})
